/*
自己选择的路 ,跪着也要走完。朋友们 , 虽然这个世界日益浮躁起来,只
要能够为了当时纯粹的梦想和感动坚持努力下去 , 不管其它人怎么样,我
们也能够保持自己的本色走下去。
To the world , you will be a person , but to a person , you
will be the world .                               ——AKPower
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define ll long long
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
const ll maxn = 4e5 + 10;
ll a[maxn], b[maxn];
ll c[maxn];
int main()
{
    ll n;
    ll I;
    scanf("%lld%lld", &n, &I);
    for (ll i = 1; i <= n; i++)
    {
        scanf("%lld", &a[i]);
    }
    sort(a + 1, a + n + 1);
    for (ll i = 1; i <= n; i++)
    {
        b[i] = a[i];
    }
    ll size = unique(b + 1, b + n + 1) - (b + 1);
    if (size == 1)
    {
        printf("0\n");
        return 0;
    }
    //每位最多可以用多少位表示
    ll bit = I * 8 / n;
    ll len = (ll)pow(2, bit);
    for (ll i = 1; i <= n; i++)
    {
        ll p = lower_bound(b + 1, b + size + 1, a[i]) - b;
        a[i] = p;
    }
    memset(c, 0, sizeof(c));
    for (ll i = 1; i <= n; i++)
    {
        c[a[i]]++;
    }
    //再变成前缀和
    c[0] = 0;
    for (ll i = 1; i <= size; i++)
    {
        c[i] += c[i - 1];
    }
    ll maxx = 0;
    for (ll i = 1; i + len - 1 <= size; i++)
    {
        if (maxx < c[i + len - 1] - c[i - 1])
        {
            maxx = c[i + len - 1] - c[i - 1];
        }
    }
    printf("%lld\n", n - maxx);

    getchar();
    getchar();
    return 0;
}
